﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;

namespace LinearSystemEquationsMatrixGenerator
{
    class Program
    {
        static void Main(string[] args)
        {
            int mSize = 1000;
            double epsilon = 0.0001;
            double[][] aMatrix = new double[mSize][];
            double[] bMatrix = new double[mSize];
            // Generate output file
            Random randomGenerator = new Random();
            for (int i = 0; i < mSize; i++)
            {
                aMatrix[i] = new double[mSize];
                for (int j = 0; j < mSize; j++)
                {
                    if (i == j)
                    {
                        aMatrix[i][j] = randomGenerator.Next(100000, 250000);
                    }
                    else
                    {
                        aMatrix[i][j] = randomGenerator.Next(-30, 30);
                    }
                }
                bMatrix[i] = randomGenerator.Next(-500, 500);
            }

            // Write file
            using (StreamWriter sw = new StreamWriter("data_set.txt"))
            {
                sw.WriteLine(mSize.ToString() + " " + epsilon.ToString(CultureInfo.InvariantCulture));
                for (int i = 0; i < mSize; i++)
                {
                    for (int j = 0; j < mSize; j++)
                    {
                        sw.Write(aMatrix[i][j].ToString() + " ");
                    }
                    // Write valueof B matrix:
                    sw.Write(bMatrix[i].ToString());
                    sw.WriteLine();
                }
            }
        }
    }
}
